package cn.iocoder.yudao.module.ao.dal.mysql.major;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.major.MajorDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.major.vo.*;

/**
 * 专业信息 Mapper
 *
 * @author 智教云枢
 */
@Mapper
public interface MajorMapper extends BaseMapperX<MajorDO> {

    default PageResult<MajorDO> selectPage(MajorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MajorDO>()
                .eqIfPresent(MajorDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(MajorDO::getSchoolId, reqVO.getSchoolId())
                .likeIfPresent(MajorDO::getMajorName, reqVO.getMajorName())
                .eqIfPresent(MajorDO::getMajorCode, reqVO.getMajorCode())
                .eqIfPresent(MajorDO::getDuration, reqVO.getDuration())
                .eqIfPresent(MajorDO::getTotalCredits, reqVO.getTotalCredits())
                .eqIfPresent(MajorDO::getMajorDirectorId, reqVO.getMajorDirectorId())
                .eqIfPresent(MajorDO::getDescription, reqVO.getDescription())
                .eqIfPresent(MajorDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MajorDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(MajorDO::getMajorId));
    }

}